<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1">
  <link rel="shortcut icon" href="/unit/resource/img/favicon.ico">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <link href="/plugin/animate/animate.css" rel="stylesheet" />
  <link href="/plugin/layui/css/layui.css" rel="stylesheet" />
  <link href="/unit/resource/css/style.css" rel="stylesheet" />
  <title>业务办理-入会业务-业务办理</title>
  <script src="/plugin/jquery/jquery.min.js"></script>
  <script src="/plugin/jquery/jquery.plugin.js"></script>
  <script src="/plugin/vue/vue.min.js"></script>
  <script src="/plugin/layui/layui.all.js"></script>
  <script src="/unit/resource/js/script.js"></script>
</head>
<body>
<div class="page">
  <!-- 头部信息 -->
  <th:block th:include="include :: top"/>
  <div class="center">
    <div class="page-content page-wrap">
      <!-- 左侧导航 -->
      <th:block th:include="include :: left"/>
      <div class="page-wrap-container">

        <div class="page-account">
          <div class="page-tab">
            <a href="/hzpolicy/hzPolicyFront/policySituation">参互情况</a>
            <a class="on" href="/hzpolicy/hzPolicyFront/policyApply">业务办理</a>
            <a href="/hzpolicy/hzPolicyFront/policyPerson">职工入会</a>
          </div>

          <!-- 业务办理列表 -->
          <div id="applyList" class="page-tab-content" style="display: block;padding-top:30px;">
            <h3 style="margin:30px 0 10px 0">2020年度入会已结束，新一年度的入会电话详询：04715222966</h3>
            <!-- <a class="layui-btn apply-btn-create" data-id="1">发起入会申请业务</a>
            <a class="layui-btn apply-btn-create" data-id="2">发起涉密入会申请业务</a> -->
            <h3 style="margin:30px 0 10px 0">办理批次记录</h3>
            <table class="page-table page-table-list" style="margin-bottom:40px">
              <tr>
                <th>业务类型</th>
                <th>办理情况</th>
                <th>办理活动</th>
                <th style="width:80px;">操作</th>
              </tr>
              <c:if test="${empty hzPolicyInfos}">
                <tr><td colspan="5" style="padding:20px;">暂无办理信息</td></tr>
              </c:if>
              <c:if test="${not empty hzPolicyInfos}">
                <c:forEach items="${hzPolicyInfos}" var="hzPolicyInfo">
                  <tr>
                    <td valign="top">
                      <p>业务批次：${hzPolicyInfo.policyno}</p>
                      <p>业务类型：
                        <c:choose>
                          <c:when test="${hzPolicyInfo.pmode == '1'}">
                            单位入会
                          </c:when>
                          <c:otherwise>
                            单位入会
                          </c:otherwise>
                        </c:choose>
                      </p>
                      <p>汇总金额：${hzPolicyInfo.totalamount}元</p>
                    </td>
                    <td valign="top">
                      <p>办理时间：${hzPolicyInfo.updateTime}</p>
                      <p>
                        办理步骤：
                        <c:choose>
                          <c:when test="${hzPolicyInfo.back == 1}">
                            <span style="color:red">申请退回</span>
                          </c:when>
                          <c:when test="${not empty hzPolicyInfo.stepId}">
                            <c:if test="${hzPolicyInfo.complete == 1}">
                              <span style="color:green">${hzPolicyInfo.stepName}</span>
                            </c:if>
                            <c:if test="${hzPolicyInfo.complete == 0}">
                              <span style="color:red">${hzPolicyInfo.stepName}</span>
                            </c:if>
                          </c:when>
                          <c:otherwise>
                            <span style="color:red">上传资料</span>
                          </c:otherwise>
                        </c:choose>
                      </p>
                    </td>
                    <td valign="top">
                      <div style="margin:2px 0;">
                        <c:forEach items="${hzPolicyInfo.insuranceNames}" var="insuranceName">
                          <p>《${insuranceName}》</p>
                        </c:forEach>
                      </div>
                    </td>
                    <td valign="top">
                      <c:if test="${empty hzPolicyInfo.stepId}">
                        <a class="layui-btn layui-btn-sm" href="/hzpolicy/hzPolicyFront/launchPolicyApply?id=${hzPolicyInfo.policyId}">继续申请</a>
                      </c:if>
                      <c:if test="${not empty hzPolicyInfo.stepId}">
                        <!-- 正在办理或办理完毕，查看详情 -->
                        <a class="layui-btn layui-btn-sm layui-btn-primary" href="javascript:;" data-id="${hzPolicyInfo.policyId}" onclick="applyDetails()">查看详情</a>
                      </c:if>
                    </td>
                  </tr>
                </c:forEach>
              </c:if>

            </table>
            <h3 style="margin:10px 0">所属机构</h3>
            <table class="page-table">
              <tr>
                <th>机构名称</th>
                <td>${officeInfo.name}</td>
              </tr>
            </table>
          </div>

        </div>
      </div>
    </div>
  </div>
  <!-- 底部信息 -->
  <th:block th:include="include :: footer"/>
</div>

<script type="text/javascript">

  /* 查看详情 */
  $('.layui-btn-primary').click(function () {
    window.location.href = "/hzpolicy/hzPolicyFront/policyApplyDetails?id=" + $(this).attr("data-id");
  })

  /* 发起入会申请 */
  $(".apply-btn-create").click(function () {
    var policyType = $(this).attr("data-id"); // 1：普通入会  2：涉密入会
    layer.confirm('确实要发起入会申请吗？', {
      btn: ['发起', '取消']
    }, function () {
      $.soon.ajax({
        url: "/hzpolicy/hzPolicyFront/createPolicyApply?policyType="+ policyType,
        method : 'Post',
        dataType: "json",
        success: function (data) {
          if(data.success){
            layer.msg("处理成功");
            setTimeout(function () {
              window.location.href = "/hzpolicy/hzPolicyFront/launchPolicyApply?id=" + data.body.policy.id;
            }, 1000);
          }else{
            layer.msg(data.msg);
          }
        }
      });
    });
  });

</script>

</body>
</html>
